/**
 * @file router
 * @author cappyli(cappy.li@gwtsz.net)
 */
import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router);

const Home = r => require.ensure([], () => r(require('@/pages/Home')), 'indexPage');
const HomeIndex = r => require.ensure([], () => r(require('@/pages/homePages/HomeIndex')), 'indexPage');
const IssueList = resolve => require(['@/pages/homePages/IssueList'],resolve);
const Content = resolve => require(['@/pages/homePages/Content'],resolve);
const Search = resolve => require(['@/pages/Search'],resolve);
const Chat = resolve => require(['@/pages/Chat'],resolve);
export default new Router({
    routes: [
        {path: '*', redirect: '/home'},
        {
            path: '/home',
            component: Home,
            children: [
                {
                    name: 'HomeIndex',
                    path: '',
                    component: HomeIndex
                },
                {
                    name: 'IssueList',
                    path: 'list/:listId',
                    component: IssueList
                },
                {
                    name: 'Content',
                    path: 'content/:contentId',
                    component: Content

                }
            ]
        },
        {
            path: '/search',
            name: 'Search',
            component: Search,
        },
        {
            path: '/chat',
            name: 'Chat',
            component: Chat,
        }
    ]
})
